package cn.zn.modules.loan.old.service.impl;

import cn.zn.framework.common.utils.PageUtils;
import cn.zn.modules.loan.old.dao.TLoanDetailDao;
import cn.zn.modules.loan.old.entity.TLoanDetailEntity;
import cn.zn.modules.loan.old.service.TLoanDetailService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("tLoanDetailService")
public class TLoanDetailServiceImpl extends ServiceImpl<TLoanDetailDao, TLoanDetailEntity> implements TLoanDetailService {

    @Override
    public PageUtils queryPage(TLoanDetailEntity tLoanDetail, IPage<TLoanDetailEntity> page) {

        QueryWrapper<TLoanDetailEntity> tLoanDetailQueryWrapper = Wrappers.query();

        IPage<TLoanDetailEntity> pageResult = this.page(page, tLoanDetailQueryWrapper);
        return new PageUtils(pageResult);
    }

    @Override
    public TLoanDetailEntity findByApplyCode(String applyCode) {
        QueryWrapper<TLoanDetailEntity> queryWrapper = Wrappers.query();
        queryWrapper.eq("APPLY_CODE_", applyCode);
        return this.baseMapper.selectOne(queryWrapper);
    }

    @Override
    public List<TLoanDetailEntity> findByApplyCode(List<String> applyCodes) {
        QueryWrapper<TLoanDetailEntity> queryWrapper = Wrappers.query();
        queryWrapper.in("APPLY_CODE_", applyCodes);
        return this.baseMapper.selectList(queryWrapper);
    }

}